package com.some;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class BaiDu_12_3 {

    public int kList(int[] nums, int k) {
        // 首选求出长度为k子序列
        int[] sum = new int[1];
        dfs(sum, 0, 0, nums, k, 0);
        return sum[0];
    }

    // 子序列
    public void dfs(int[] sum, int size, int listSum, int[] nums, int k, int index) {
        if (size == k && listSum % 2 == 0) {
            /*for (Integer integer : list) {
                System.out.print(integer);
            }
            System.out.println();*/
            sum[0]++;
            return;
        }
        if (size == k) {
            return;
        }
        if (size > k) {
            return;
        }
        for (int i = index; i < nums.length; i++) {
            dfs(sum, size + 1, listSum + nums[i], nums, k, i + 1);
        }
    }
}

class Main_12_3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BaiDu_12_3 baiDu_12_3 = new BaiDu_12_3();
        // 输入有多少组测试数据
        int t = sc.nextInt();
        // 结果集和
        int[] res = new int[t];
        for (int i = 0; i < t; i++) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            // 单个测试数据
            int[] nums = new int[n];
            for (int j = 0; j < n; j++) {
                nums[j] = sc.nextInt();
            }
            res[i] = baiDu_12_3.kList(nums, k);
        }
        for (int re : res) {
            System.out.println(re);
        }
    }
}
